package practice;

import java.util.ArrayList;
import java.util.List;

/** 一对兔子 */
public class APairOfRabbits {
	public int age = 0;

	public static void main(String[] args) {
		List<APairOfRabbits> rabbitsList = new ArrayList<>();
		rabbitsList.add(new APairOfRabbits());
		int n = 24;
		for (int i = 1, m; i <= n; i++) {
			m = 0;
			for (APairOfRabbits rabbits : rabbitsList)
				if (++rabbits.age >= 3)
					m++;
			for (int j = 0; j < m; j++)
				rabbitsList.add(new APairOfRabbits());
			System.out.println("第" + i + "个月兔子总数：" + rabbitsList.size() * 2);
		}
	}
}
